package cn.udrm.water.base.v1.waterdelivery.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import org.hibernate.annotations.GenericGenerator;

/**
 * 渠道扩展表
 * 扩展渠道字段, 比如管理单位外键、行政区划外键等
 * @author liukang
 * @date 2018年11月28日
 */
@Getter
@Setter
@NoArgsConstructor
@Entity(name="CanalSystemExt")
@Table(name="T_CANAL_SYSTEM_EXT")
@NamedEntityGraph(name="CanalSystemExt.canalSystem",
	attributeNodes={
		@NamedAttributeNode("canalSystem")
})
public class CanalSystemExt {
	
	@Id
	@GenericGenerator(name="idGenerator", strategy="uuid")
	@GeneratedValue(generator="idGenerator")
	@Column(name="ID")
	private String id;
	
	/*
	 * 管理单位外键关联关系
	 */
	@Column(name="MANAGER_UNIT_GUID")
	private String managerUnitGuid;
	@Column(name="MANAGER_UNIT_NAME")
	private String managerUnitName;
	
	@OneToOne(optional=true, fetch=FetchType.LAZY)
	@JoinColumn(name="CANAL_SYSTEM_GUID")
	private CanalSystem canalSystem;

}
